trigger ServicePlan on ServicePlan__c (after insert,before insert, before update,after delete) {
    
    if(trigger.isAfter)
    {
        if(trigger.isInsert)
        {
            Cbl_ServicePlanToCase.ServicePlanToCas(trigger.new);


        }
        if(trigger.isDelete)Cbl_ServicePlanToCase.UpdateAcc();///更新重点客户
    }

    if(trigger.isBefore)
    {
        if(trigger.isUpdate)
        {
            Cbl_ServicePlanToCase.UpdateCaseOwner(trigger.new, trigger.oldMap);
            Cbl_ServicePlanToCase.UpdateSerplanOwner(trigger.new);
        }
        
        if(trigger.isInsert)
        {
            Cbl_ServicePlanToCase.UpdateSerplanOwner(trigger.new);
        }
    }

}